/*
 * Bsp__motor.c
 *
 *  Created on: Apr 12, 2025
 *      Author: Administrator
 */

#ifndef BSP__MOTOR_C_
#define BSP__MOTOR_C_

#include"main.h"

#define MOTOR_IGNORE_PULSE  (1600)
#define MOTOR_MAX_PULSE     (3600)
#define MOTOR_FREQ_DIVIDE   (0)


#define PWM_M1_A		TIM8->CCR1
#define PWM_M1_B		TIM8->CCR2

#define PWM_M2_A		TIM8->CCR3
#define PWM_M2_B		TIM8->CCR4

#define PWM_M3_A		TIM1->CCR4
#define PWM_M3_B		TIM1->CCR1

#define PWM_M4_A		TIM1->CCR2
#define PWM_M4_B		TIM1->CCR3

typedef enum{
	MOTOR_ID_M1 = 0,
	MOTOR_ID_M2,
	MOTOR_ID_M3,
	MOTOR_ID_M4,
	MAX_MOTOR
}Motor_ID;

void Motor_Init(void);
void Motor_Set_Pwm(uint8_t id, int16_t speed);
void Motor_Stop(uint8_t brake);


#endif /* BSP__MOTOR_C_ */
